<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('广告位置')" />
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">

        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('system:info:edit')}]];
    var prefix = ctx + "system/info";

    $(function() {
        var options = {
            url: prefix + "/adpos",
            releaseUrl: prefix +"/release",
            modalName: "",
            columns: [{
                checkbox: true
            },
               /* {
                    field : 'id',
                    title : '创建时间',
                    visible: false
                },*/
                {
                    field : 'title',
                    title : '名称'
                },
               /* {
                    field : 'areaId',
                    title : '地区ID'
                },*/
                {
                    field : 'position',
                    title : '应用位置'
                },
               /* {
                    field : 'style',
                    title : '样式 '
                },
                {
                    field : 'tpe',
                    title : '0图; 1文; 2图文'
                },
                {
                    field : 'showCt',
                    title : '单屏显示数量'
                },
                {
                    field : 'extJson',
                    title : '扩展字段'
                },
                {
                    field : 'comment',
                    title : '备注'
                },
                {
                    field : 'modifiedAt',
                    title : '修改时间'
                },
                {
                    field : 'createdAt',
                    title : '创建时间'
                },*/{
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="choice(\'' + row.id + '\')"><i class="fa fa-edit"></i>选择</a> ');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });
function choice(id) {
    $.ajax({
        //几个参数需要注意一下
        type: "POST",//方法类型
        dataType: "json",//预期服务器返回的数据类型
        url: prefix +"/adposId",//url
        data:{"id":id},
        cache: false,
        success:function (data) {           //成功回调
            $(parent.$("#position")).attr("value",data.title);
            $(parent.$("#hideinfo")).attr("value",data.position);
            setTimeout(function(){
                $.modal.close();
            },300);
        }

    })

}
</script>
</body>
</html>